home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / JManager.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  38.8 KB  |  1,213 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        JManager.h
  3.  
  4.      Contains:    Routines that can be used to invoke the Java Virtual Machine in MRJ 
  5.  
  6.      Version:    Technology:    MRJ 2.1
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1996-1999 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __JMANAGER__
  18. #define __JMANAGER__
  19.  
  20. /*
  21.  *  Note:    If you want to use any JManger routines which use JNI or JRI functionality,
  22.  *             you must #include <jni.h> or <jri.h> before this file.
  23.  *
  24.  */
  25. #ifndef __CONDITIONALMACROS__
  26.     #include <ConditionalMacros.h>
  27. #endif
  28.  
  29. #ifndef __MACTYPES__
  30.     #include <MacTypes.h>
  31. #endif
  32.  
  33. #ifndef __FILES__
  34.     #include <Files.h>
  35. #endif
  36.  
  37. #ifndef __DRAG__
  38.     #include <Drag.h>
  39. #endif
  40.  
  41. #ifndef __QUICKDRAW__
  42.     #include <Quickdraw.h>
  43. #endif
  44.  
  45. #ifndef __MENUS__
  46.     #include <Menus.h>
  47. #endif
  48.  
  49. #ifndef __TEXTCOMMON__
  50.     #include <TextCommon.h>
  51. #endif
  52.  
  53. #ifndef __CODEFRAGMENTS__
  54.     #include <CodeFragments.h>
  55. #endif
  56.  
  57.  
  58.  
  59.  
  60. #if PRAGMA_ONCE
  61. #pragma once
  62. #endif
  63.  
  64. #ifdef __cplusplus
  65. extern "C" {
  66. #endif
  67.  
  68. #if PRAGMA_IMPORT
  69. #pragma import on
  70. #endif
  71.  
  72. #if PRAGMA_STRUCT_ALIGN
  73.     #pragma options align=mac68k
  74. #elif PRAGMA_STRUCT_PACKPUSH
  75.     #pragma pack(push, 2)
  76. #elif PRAGMA_STRUCT_PACK
  77.     #pragma pack(2)
  78. #endif
  79.  
  80. #if PRAGMA_ENUM_ALWAYSINT
  81.     #pragma enumsalwaysint on
  82. #elif PRAGMA_ENUM_OPTIONS
  83.     #pragma option enum=int
  84. #elif PRAGMA_ENUM_PACK
  85.     #if __option(pack_enums)
  86.         #define PRAGMA_ENUM_PACK__JMANAGER__
  87.     #endif
  88.     #pragma options(!pack_enums)
  89. #endif
  90.  
  91. enum {
  92.     kJMVersion                    = 0x11800007,                    /* using Sun's 1.1.8 APIs, our rev 7 APIs. */
  93.     kDefaultJMTime                = 0x00000400                    /* how much time to give the JM library on "empty" events, in milliseconds. */
  94. };
  95.  
  96. enum {
  97.     kJMVersionError                = -60000L,
  98.     kJMExceptionOccurred        = -60001L,
  99.     kJMBadClassPathError        = -60002L
  100. };
  101.  
  102. /*
  103.  * Special codes for JMFrameKey, JMFrameKeyRelease:
  104.  *
  105.  * When your app notices that a modifiers is pressed (must be done by polling,
  106.  * unless Mac OS changes to support sending modifiers as events)
  107.  * you should notify the runtime using JMFrameKey, JMFrameKeyRelease, using
  108.  * these constants for asciiChar and keyCode.  This will allow the AWT to
  109.  * synthesize the appropriate events
  110.  */
  111. enum {
  112.     kModifierAsciiChar            = 0,
  113.     kModifierKeyCode            = 0
  114. };
  115.  
  116. /*
  117.  *    Private data structures
  118.  *
  119.  *    JMClientData        - enough bits to reliably store a pointer to arbitrary, client-specific data. 
  120.  *    JMSessionRef        - references the entire java runtime 
  121.  *    JMTextRef            - a Text string, length, and encoding 
  122.  *    JMTextEncoding        - which encoding to use when converting in and out of Java strings.
  123.  *    JMFrameRef            - a java frame 
  124.  *    JMAWTContextRef     - a context for the AWT to request frames, process events 
  125.  *    JMAppletLocatorRef    - a device for locating, fetching, and parsing URLs that may contain applets 
  126.  *    JMAppletViewerRef    - an object that displays applets in a Frame 
  127.  *    JMAppletPageRef        - a way to group JMAWTContextRef's so they share the same class loader
  128.  */
  129. typedef void *                            JMClientData;
  130. typedef struct OpaqueJMSessionRef*         JMSessionRef;
  131. typedef struct OpaqueJMFrameRef*         JMFrameRef;
  132. typedef struct OpaqueJMTextRef*         JMTextRef;
  133. typedef struct OpaqueJMAWTContextRef*     JMAWTContextRef;
  134. typedef struct OpaqueJMAppletLocatorRef*  JMAppletLocatorRef;
  135. typedef struct OpaqueJMAppletViewerRef*  JMAppletViewerRef;
  136. typedef struct OpaqueJMAppletPageRef*     JMAppletPageRef;
  137. typedef TextEncoding                     JMTextEncoding;
  138.  
  139. /*
  140.  * The runtime requires certain callbacks be used to communicate between
  141.  * session events and the embedding application.
  142.  *
  143.  * In general, you can pass nil as a callback and a "good" default will be used.
  144.  *
  145.  *    JMConsoleProcPtr          - redirect stderr or stdout - the message is delivered in the encoding specified when
  146.  *                                you created the session, or possibly binary data.
  147.  *    JMConsoleReadProcPtr     - take input from the user from a console or file.  The input is expected to 
  148.  *                                be in the encoding specified when you opened the session.
  149.  *    JMExitProcPtr              - called via System.exit(int), return "true" to kill the current thread,
  150.  *                                false, to cause a 'QUIT' AppleEvent to be sent to the current process,
  151.  *                                or just tear down the runtime and exit to shell immediately
  152.  * JMLowMemoryProcPtr          - This callback is available to notify the embedding application that
  153.  *                                a low memory situation has occurred so it can attempt to recover appropriately.
  154.  * JMAuthenicateURLProcPtr  - prompt the user for autentication based on the URL.  If you pass
  155.  *                                nil, JManager will prompt the user.  Return false if the user pressed cancel.
  156.  */
  157. typedef CALLBACK_API_C( void , JMConsoleProcPtr )(JMSessionRef session, const void *message, SInt32 messageLengthInBytes);
  158. typedef CALLBACK_API_C( SInt32 , JMConsoleReadProcPtr )(JMSessionRef session, void *buffer, SInt32 maxBufferLength);
  159. typedef CALLBACK_API_C( Boolean , JMExitProcPtr )(JMSessionRef session, SInt32 status);
  160. typedef CALLBACK_API_C( Boolean , JMAuthenticateURLProcPtr )(JMSessionRef session, const char *url, const char *realm, char userName[255], char password[255])/*  into C string parameters  */;
  161. typedef CALLBACK_API_C( void , JMLowMemoryProcPtr )(JMSessionRef session);
  162.  
  163. struct JMSessionCallbacks {
  164.     UInt32                             fVersion;                    /* should be set to kJMVersion */
  165.     JMConsoleProcPtr                 fStandardOutput;            /* JM will route "stdout" to this function. */
  166.     JMConsoleProcPtr                 fStandardError;                /* JM will route "stderr" to this function. */
  167.     JMConsoleReadProcPtr             fStandardIn;                /* read from console - can be nil for default behavior (no console IO) */
  168.     JMExitProcPtr                     fExitProc;                    /* handle System.exit(int) requests */
  169.     JMAuthenticateURLProcPtr         fAuthenticateProc;            /* present basic authentication dialog */
  170.     JMLowMemoryProcPtr                 fLowMemProc;                /* Low Memory notification Proc */
  171. };
  172. typedef struct JMSessionCallbacks        JMSessionCallbacks;
  173.  
  174. enum JMVerifierOptions {
  175.     eDontCheckCode                = 0,
  176.     eCheckRemoteCode            = 1,
  177.     eCheckAllCode                = 2
  178. };
  179. typedef enum JMVerifierOptions JMVerifierOptions;
  180.  
  181.  
  182. /*
  183.  * JMRuntimeOptions is a mask that allows you to specify certain attributes
  184.  * for the runtime. Bitwise or the fields together, or use one of the "premade" entries.
  185.  * eJManager2Defaults is the factory default, and best bet to use.
  186.  */
  187.  
  188. enum JMRuntimeOptions {
  189.     eJManager2Defaults            = 0,
  190.     eUseAppHeapOnly                = (1 << 0),
  191.     eDisableJITC                = (1 << 1),
  192.     eEnableDebugger                = (1 << 2),
  193.     eDisableInternetConfig        = (1 << 3),
  194.     eInhibitClassUnloading        = (1 << 4),
  195.     eEnableProfiling            = (1 << 5),
  196.     eJManager1Compatible        = (eDisableInternetConfig | eInhibitClassUnloading)
  197. };
  198. typedef enum JMRuntimeOptions JMRuntimeOptions;
  199.  
  200.  
  201.  
  202.  
  203. /*
  204.  * Returns the version of the currently installed JManager library.
  205.  * Compare to kJMVersion.  This is the only call that doesn't
  206.  * require a session, or a reference to something that references
  207.  * a session.
  208.  */
  209. EXTERN_API_C( unsigned long )
  210. JMGetVersion                    (void);
  211.  
  212. /*
  213.  * Returns the version number of the MRJ installation.  This is an
  214.  * official version number that will change for each official release
  215.  * of MRJ, whereas for an incremental MRJ release, the version number
  216.  * returned by JMGetVersion may not change.
  217.  */
  218. EXTERN_API_C( UInt32 )
  219. JMGetMRJRuntimeVersion            (void);
  220.  
  221. /*
  222.  * JMOpenSession creates a new Java Runtime.  Note that JManger 2.0 doesn't set 
  223.  * security options at the time of runtime instantiation.  AppletViewer Objecs have
  224.  * seperate security attributes bound to them, and the verifier is availiable elsewhere
  225.  * as well.  The client data parameter lets a client associate an arbitgrary tagged pointer
  226.  * with the seession.
  227.  * When you create the session, you must specify the desired Text Encoding to use for
  228.  * console IO.  Usually, its OK to use "kTextEncodingMacRoman".  See TextCommon.h for the list.
  229.  */
  230. EXTERN_API_C( OSStatus )
  231. JMOpenSession                    (JMSessionRef *            session,
  232.                                  JMRuntimeOptions         runtimeOptions,
  233.                                  JMVerifierOptions         verifyMode,
  234.                                  const JMSessionCallbacks * callbacks,
  235.                                  JMTextEncoding         desiredEncoding,
  236.                                  JMClientData             data);
  237.  
  238. EXTERN_API_C( OSStatus )
  239. JMCloseSession                    (JMSessionRef             session);
  240.  
  241.  
  242. /*
  243.  * Client data getter/setter functions.
  244.  */
  245. EXTERN_API_C( OSStatus )
  246. JMGetSessionData                (JMSessionRef             session,
  247.                                  JMClientData *            data);
  248.  
  249. EXTERN_API_C( OSStatus )
  250. JMSetSessionData                (JMSessionRef             session,
  251.                                  JMClientData             data);
  252.  
  253.  
  254. /*
  255.  * Prepend the target of the FSSpec to the class path.
  256.  * If a file, .zip or other known archive file - not a .class file
  257.  */
  258. EXTERN_API_C( OSStatus )
  259. JMAddToClassPath                (JMSessionRef             session,
  260.                                  const FSSpec *            spec);
  261.  
  262.  
  263. /*
  264.  * Utility returns (client owned) null terminated handle containing "file://xxxx", or nil if fnfErr
  265.  */
  266. EXTERN_API_C( Handle )
  267. JMFSSToURL                        (JMSessionRef             session,
  268.                                  const FSSpec *            spec);
  269.  
  270.  
  271. /*
  272.  * Turns "file:///disk/file" into an FSSpec.  other handlers return paramErr
  273.  */
  274. EXTERN_API_C( OSStatus )
  275. JMURLToFSS                        (JMSessionRef             session,
  276.                                  JMTextRef                 urlString,
  277.                                  FSSpec *                spec);
  278.  
  279.  
  280. /*
  281.  * JMIdle gives time to all Java threads. Giving more time makes Java programs run faster,
  282.  * but can reduce overall system responsiveness. JMIdle will return sooner if low-level (user)
  283.  * events appear in the event queue.
  284.  */
  285. EXTERN_API_C( OSStatus )
  286. JMIdle                            (JMSessionRef             session,
  287.                                  UInt32                 jmTimeMillis);
  288.  
  289.  
  290. /*
  291.  * JMGetCurrenvEnv gives access to the underlying JRI interface, if available.
  292.  * This gives the client more control over the underlying Java runtime, without
  293.  * exposing the implementation too much.
  294.  * NOTE: JRI is deprecated; please upgrade your code to work with JNI instead.
  295.  */
  296. #ifdef JRI_H
  297. EXTERN_API_C( JRIRuntimeInstance *)
  298. JMGetJRIRuntimeInstance            (JMSessionRef             session);
  299.  
  300. EXTERN_API_C( JRIEnv *)
  301. JMGetCurrentJRIEnv                (JMSessionRef             session);
  302.  
  303. #endif  /* defined(JRI_H) */
  304.  
  305. /*
  306.  * JNI is to be preferred.
  307.  */
  308. #ifdef JNI_H
  309. EXTERN_API_C( JNIEnv *)
  310. JMGetCurrentEnv                    (JMSessionRef             session);
  311.  
  312. #endif  /* defined(JNI_H) */
  313.  
  314. /*
  315.  * Since JManager calls reutrn jref (JRI Java references)
  316.  * you need to convert between them and JNI references (jobjects) if you're
  317.  * using JNI.  These routines facilitate that conversion.
  318.  */
  319. #if defined(JRI_H) && defined(JNI_H)
  320. EXTERN_API_C( jobject )
  321. JMJRIRefToJNIObject                (JMSessionRef             session,
  322.                                  JNIEnv *                env,
  323.                                  jref                     jriRef);
  324.  
  325. EXTERN_API_C( jref )
  326. JMJNIObjectToJRIRef                (JMSessionRef             session,
  327.                                  JNIEnv *                env,
  328.                                  jobject                 jniObject);
  329.  
  330. #endif  /* defined(JRI_H) && defined(JNI_H) */
  331.  
  332. /*
  333.  * Java defines system-wide properties that applets can use to make queries about the
  334.  * host system. Many of these properties correspond to defaults provided by "Internet Config."
  335.  * JMPutSessionProperty can be used by a client program to modify various system-wide properties.
  336.  */
  337. EXTERN_API_C( OSStatus )
  338. JMGetSessionProperty            (JMSessionRef             session,
  339.                                  JMTextRef                 propertyName,
  340.                                  JMTextRef *            propertyValue);
  341.  
  342. EXTERN_API_C( OSStatus )
  343. JMPutSessionProperty            (JMSessionRef             session,
  344.                                  JMTextRef                 propertyName,
  345.                                  JMTextRef                 propertyValue);
  346.  
  347.  
  348. /*
  349.  * Returns a com.apple.mrj.JManager.JMSession object
  350.  */
  351. #ifdef JNI_H
  352. EXTERN_API_C( jobject )
  353. JMGetSessionJNIObject            (JMSessionRef             session,
  354.                                  JNIEnv *                env);
  355.  
  356. #endif  /* defined(JNI_H) */
  357.  
  358. #ifdef JRI_H
  359. EXTERN_API_C( jref )
  360. JMGetSessionObject                (JMSessionRef             session);
  361.  
  362. #endif  /* defined(JRI_H) */
  363.  
  364. /*
  365.  * JMText: opaque object that encapsulates a string, length, and
  366.  * character encoding.  Strings passed between JManager and the
  367.  * embedding application goes through this interface.  Only the most
  368.  * rudimentary conversion routines are supplied - it is expected that
  369.  * the embedding application will most of its work in the System Script.
  370.  *
  371.  * These APIs present some questions about who actually owns the 
  372.  * JMText.  The rule is, if you created a JMTextRef, you are responsible
  373.  * for deleting it after passing it into the runtime.  If the runtime passes
  374.  * one to you, it will be deleted after the callback.
  375.  *
  376.  * If a pointer to an uninitialised JMTextRef is passed in to a routine (eg JMGetSessionProperty),
  377.  * it is assumed to have been created for the caller, and it is the callers responsibility to
  378.  * dispose of it.
  379.  *
  380.  * The encoding types are taken verbatim from the Text Encoding Converter,
  381.  * which handles the ugly backside of script conversion.
  382.  */
  383. /*
  384.  * JMNewTextRef can create from a buffer of data in the specified encoding
  385.  */
  386. EXTERN_API_C( OSStatus )
  387. JMNewTextRef                    (JMSessionRef             session,
  388.                                  JMTextRef *            textRef,
  389.                                  JMTextEncoding         encoding,
  390.                                  const void *            charBuffer,
  391.                                  UInt32                 bufferLengthInBytes);
  392.  
  393.  
  394. /*
  395.  * JMCopyTextRef clones a text ref.
  396.  */
  397. EXTERN_API_C( OSStatus )
  398. JMCopyTextRef                    (JMTextRef                 textRefSrc,
  399.                                  JMTextRef *            textRefDst);
  400.  
  401.  
  402. /*
  403.  * Disposes of a text ref passed back from the runtime, or created explicitly through JMNewTextRef
  404.  */
  405. EXTERN_API_C( OSStatus )
  406. JMDisposeTextRef                (JMTextRef                 textRef);
  407.  
  408.  
  409. /*
  410.  * Returns the text length, in characters
  411.  */
  412. EXTERN_API_C( OSStatus )
  413. JMGetTextLength                    (JMTextRef                 textRef,
  414.                                  UInt32 *                textLengthInCharacters);
  415.  
  416.  
  417. /*
  418.  * Returns the text length, in number of bytes taken in the destination encoding
  419.  */
  420. EXTERN_API_C( OSStatus )
  421. JMGetTextLengthInBytes            (JMTextRef                 textRef,
  422.                                  JMTextEncoding         dstEncoding,
  423.                                  UInt32 *                textLengthInBytes);
  424.  
  425.  
  426. /*
  427.  * Copies the specified number of characters to the destination buffer with the appropriate
  428.  * destination encoding.
  429.  */
  430. EXTERN_API_C( OSStatus )
  431. JMGetTextBytes                    (JMTextRef                 textRef,
  432.                                  JMTextEncoding         dstEncoding,
  433.                                  void *                    textBuffer,
  434.                                  UInt32                 textBufferLength,
  435.                                  UInt32 *                numCharsCopied);
  436.  
  437.  
  438. /*
  439.  * Return the JMText as a reference to a Java String.  Note that
  440.  * this is the only reference to the string - it will be collected if you don't
  441.  * hang on to it.
  442.  */
  443. #ifdef JNI_H
  444. EXTERN_API_C( jstring )
  445. JMTextToJNIJavaString            (JMTextRef                 textRef,
  446.                                  JMSessionRef             session,
  447.                                  JNIEnv *                env);
  448.  
  449. #endif  /* defined(JNI_H) */
  450.  
  451. #ifdef JRI_H
  452. EXTERN_API_C( jref )
  453. JMTextToJavaString                (JMTextRef                 textRef);
  454.  
  455. #endif  /* defined(JRI_H) */
  456.  
  457. /*
  458.  * Returns a Handle to a null terminated, "C" string in the System Script.
  459.  * Note that using this routine could result in data loss, if the characters
  460.  * are not availiable in the System Script.
  461.  */
  462. EXTERN_API_C( Handle )
  463. JMTextToMacOSCStringHandle        (JMTextRef                 textRef);
  464.  
  465.  
  466.  
  467.  
  468. /*
  469.  * Proxy properties in the runtime.
  470.  *
  471.  * These will only be checked if InternetConfig isn't used to specify properties,
  472.  * or if it doesn't have the data for these.
  473.  */
  474.  
  475. struct JMProxyInfo {
  476.     Boolean                         useProxy;
  477.     char                             proxyHost[255];
  478.     UInt16                             proxyPort;
  479. };
  480. typedef struct JMProxyInfo                JMProxyInfo;
  481.  
  482. enum JMProxyType {
  483.     eHTTPProxy                    = 0,
  484.     eFirewallProxy                = 1,
  485.     eFTPProxy                    = 2
  486. };
  487. typedef enum JMProxyType JMProxyType;
  488.  
  489. EXTERN_API_C( OSStatus )
  490. JMGetProxyInfo                    (JMSessionRef             session,
  491.                                  JMProxyType             proxyType,
  492.                                  JMProxyInfo *            proxyInfo);
  493.  
  494. EXTERN_API_C( OSStatus )
  495. JMSetProxyInfo                    (JMSessionRef             session,
  496.                                  JMProxyType             proxyType,
  497.                                  const JMProxyInfo *    proxyInfo);
  498.  
  499.  
  500. /*
  501.  * Security - JManager 2.0 security is handled on a per-applet basis.
  502.  * There are some security settings that are inherited from InternetConfig
  503.  * (Proxy Servers) but the verifier can now be enabled and disabled.
  504.  */
  505. EXTERN_API_C( OSStatus )
  506. JMGetVerifyMode                    (JMSessionRef             session,
  507.                                  JMVerifierOptions *    verifierOptions);
  508.  
  509. EXTERN_API_C( OSStatus )
  510. JMSetVerifyMode                    (JMSessionRef             session,
  511.                                  JMVerifierOptions         verifierOptions);
  512.  
  513.  
  514.  
  515.  
  516. /*
  517.  * The basic unit of AWT interaction is the JMFrame.  A JMFrame is bound to top level
  518.  * awt Frame, Window, or Dialog.  When a user event occurs for a MacOS window, the event is passed
  519.  * to the corrosponding frame object.  Similarly, when an AWT event occurs that requires the
  520.  * Mac OS Window to change, a callback is made.  JManager 1.x bound the frame to the window through
  521.  * a callback to set and restore the windows GrafPort.  In JManager 2.0, a GrafPort, Offset, and 
  522.  * ClipRgn are specified up front - changes in visibility and structure require that these be re-set.
  523.  * This enables support for the JavaSoft DrawingSurface API - and also improves graphics performance.
  524.  * You should reset the graphics attributes anytime the visiblity changes, like when scrolling.
  525.  * You should also set it initially when the AWTContext requests the frame.
  526.  * At various times, JM will call back to the client to register a new JMFrame, 
  527.  * indicating the frame type.  The client should take the following steps:
  528.  *
  529.  *    o    Create a new invisible window of the specified type
  530.  *    o    Fill in the callbacks parameter with function pointers
  531.  *    o    Do something to bind the frame to the window (like stuff the WindowPtr in the JMClientData of the frame)
  532.  *    o    Register the visiblity parameters (GrafPtr, etc) with the frame
  533.  */
  534.  
  535. enum ReorderRequest {
  536.     eBringToFront                = 0,                            /* bring the window to front */
  537.     eSendToBack                    = 1,                            /* send the window to back */
  538.     eSendBehindFront            = 2                                /* send the window behind the front window */
  539. };
  540. typedef enum ReorderRequest ReorderRequest;
  541.  
  542. typedef CALLBACK_API_C( void , JMSetFrameSizeProcPtr )(JMFrameRef frame, const Rect *newBounds);
  543. typedef CALLBACK_API_C( void , JMFrameInvalRectProcPtr )(JMFrameRef frame, const Rect *r);
  544. typedef CALLBACK_API_C( void , JMFrameShowHideProcPtr )(JMFrameRef frame, Boolean showFrameRequested);
  545. typedef CALLBACK_API_C( void , JMSetTitleProcPtr )(JMFrameRef frame, JMTextRef title);
  546. typedef CALLBACK_API_C( void , JMCheckUpdateProcPtr )(JMFrameRef frame);
  547. typedef CALLBACK_API_C( void , JMReorderFrame )(JMFrameRef frame, ReorderRequest theRequest);
  548. typedef CALLBACK_API_C( void , JMSetResizeable )(JMFrameRef frame, Boolean resizeable);
  549. typedef CALLBACK_API_C( void , JMGetFrameInsets )(JMFrameRef frame, Rect *insets);
  550. /*
  551.  * New in JManager 2.1:
  552.  *    If the AWT needs to set focus to a frame (in the case of multiple JMFrames within
  553.  *     a single Mac OS Frame) it will call back to the embedding application using
  554.  *    JMRRequestFocus.  The application should then defocus what it thought did have the
  555.  *  focus, and set the focus to the new frame.
  556.  *  If the user is tabbing within a JMFrame, and the focus reaches the last focusable
  557.  *  component (or the first, if focus is traversing backwards) JMNexetFocus will be called.
  558.  *  The application should defocus the component that requests this, and focus the next application
  559.  *  visible focusable element.  (If none, send focus back to the frame.)
  560.  */
  561. typedef CALLBACK_API_C( void , JMNextFocus )(JMFrameRef frame, Boolean forward);
  562. typedef CALLBACK_API_C( void , JMRequestFocus )(JMFrameRef frame);
  563.  
  564. struct JMFrameCallbacks {
  565.     UInt32                             fVersion;                    /* should be set to kJMVersion */
  566.     JMSetFrameSizeProcPtr             fSetFrameSize;
  567.     JMFrameInvalRectProcPtr         fInvalRect;
  568.     JMFrameShowHideProcPtr             fShowHide;
  569.     JMSetTitleProcPtr                 fSetTitle;
  570.     JMCheckUpdateProcPtr             fCheckUpdate;
  571.     JMReorderFrame                     fReorderFrame;
  572.     JMSetResizeable                 fSetResizeable;
  573.     JMGetFrameInsets                 fGetInsets;
  574.     JMNextFocus                     fNextFocus;
  575.     JMRequestFocus                     fRequestFocus;
  576. };
  577. typedef struct JMFrameCallbacks            JMFrameCallbacks;
  578. EXTERN_API_C( OSStatus )
  579. JMSetFrameVisibility            (JMFrameRef             frame,
  580.                                  GrafPtr                 famePort,
  581.                                  Point                     frameOrigin,
  582.                                  RgnHandle                 frameClip);
  583.  
  584. EXTERN_API_C( OSStatus )
  585. JMGetFrameData                    (JMFrameRef             frame,
  586.                                  JMClientData *            data);
  587.  
  588. EXTERN_API_C( OSStatus )
  589. JMSetFrameData                    (JMFrameRef             frame,
  590.                                  JMClientData             data);
  591.  
  592. EXTERN_API_C( OSStatus )
  593. JMGetFrameSize                    (JMFrameRef             frame,
  594.                                  Rect *                    result);
  595.  
  596. /* note that the top left indicates the "global" position of this frame */
  597. /* use this to update the frame position when it gets moved */
  598. EXTERN_API_C( OSStatus )
  599. JMSetFrameSize                    (JMFrameRef             frame,
  600.                                  const Rect *            newSize);
  601.  
  602. /*
  603.  * Dispatch a particular event to an embedded frame
  604.  */
  605. EXTERN_API_C( OSStatus )
  606. JMFrameClickWithEventRecord        (JMFrameRef             frame,
  607.                                  Point                     localPos,
  608.                                  const EventRecord *    event);
  609.  
  610. EXTERN_API_C( OSStatus )
  611. JMFrameKey                        (JMFrameRef             frame,
  612.                                  char                     asciiChar,
  613.                                  char                     keyCode,
  614.                                  short                     modifiers);
  615.  
  616. EXTERN_API_C( OSStatus )
  617. JMFrameKeyRelease                (JMFrameRef             frame,
  618.                                  char                     asciiChar,
  619.                                  char                     keyCode,
  620.                                  short                     modifiers);
  621.  
  622. EXTERN_API_C( OSStatus )
  623. JMFrameUpdate                    (JMFrameRef             frame,
  624.                                  RgnHandle                 updateRgn);
  625.  
  626. EXTERN_API_C( OSStatus )
  627. JMFrameActivate                    (JMFrameRef             frame,
  628.                                  Boolean                 activate);
  629.  
  630. EXTERN_API_C( OSStatus )
  631. JMFrameResume                    (JMFrameRef             frame,
  632.                                  Boolean                 resume);
  633.  
  634. EXTERN_API_C( OSStatus )
  635. JMFrameMouseOver                (JMFrameRef             frame,
  636.                                  Point                     localPos,
  637.                                  short                     modifiers);
  638.  
  639. EXTERN_API_C( OSStatus )
  640. JMFrameShowHide                    (JMFrameRef             frame,
  641.                                  Boolean                 showFrame);
  642.  
  643. EXTERN_API_C( OSStatus )
  644. JMFrameGoAway                    (JMFrameRef             frame);
  645.  
  646. EXTERN_API_C( JMAWTContextRef )
  647. JMGetFrameContext                (JMFrameRef             frame);
  648.  
  649. EXTERN_API_C( OSStatus )
  650. JMFrameDragTracking                (JMFrameRef             frame,
  651.                                  DragTrackingMessage     message,
  652.                                  DragReference             theDragRef);
  653.  
  654. EXTERN_API_C( OSStatus )
  655. JMFrameDragReceive                (JMFrameRef             frame,
  656.                                  DragReference             theDragRef);
  657.  
  658. /*
  659.  * JMFrameClick is deprecated - please use JMFrameClickWithEventRecord instead.
  660.  */
  661. EXTERN_API_C( OSStatus )
  662. JMFrameClick                    (JMFrameRef             frame,
  663.                                  Point                     localPos,
  664.                                  short                     modifiers);
  665.  
  666. /*
  667.  * If you may have multiple JMFrames in a single Mac OS Window (for example,
  668.  * in a browser) then use JMFrameFocus to control when you believe the
  669.  * frame should logically contain the focus.  This will allow for the correct
  670.  * appearance of Controls and Text Fields.  If you will only have one
  671.  * JMFrame per Mac OS Window, use JMFrameFocus as well as JMFrameActivate to
  672.  * control hiliting.
  673.  */
  674. EXTERN_API_C( OSStatus )
  675. JMFrameFocus                    (JMFrameRef             frame,
  676.                                  Boolean                 gotFocus);
  677.  
  678. /*
  679.  * Cause a Frame and its contents to be rendered in a GrafPort.
  680.  * This is typically going to be used to cause an applet to print itself
  681.  * into a PrGrafPort.
  682.  * If you pass 'true' as the last parameter, the paint(Graphics) method of the
  683.  * frame is called, rather than print(Graphics).
  684.  */
  685. EXTERN_API_C( OSStatus )
  686. JMDrawFrameInPort                (JMFrameRef             frame,
  687.                                  GrafPtr                 framePort,
  688.                                  Point                     frameOrigin,
  689.                                  RgnHandle                 clipRgn,
  690.                                  Boolean                 callPaintAsOpposedToPrint);
  691.  
  692. /* 
  693.  * returns the java.awt.Frame for this frame 
  694. */
  695. #ifdef JNI_H
  696. EXTERN_API_C( jobject )
  697. JMGetAWTFrameJNIObject            (JMFrameRef             frame,
  698.                                  JNIEnv *                env);
  699.  
  700. #endif  /* defined(JNI_H) */
  701.  
  702. #ifdef JRI_H
  703. EXTERN_API_C( jref )
  704. JMGetAWTFrameObject                (JMFrameRef             frame);
  705.  
  706. #endif  /* defined(JRI_H) */
  707.  
  708. /* 
  709.  * returns the com.apple.mrj.JManager.JMFrame for this frame 
  710.  */
  711. #ifdef JNI_H
  712. EXTERN_API_C( jobject )
  713. JMGetJMFrameJNIObject            (JMFrameRef             frame,
  714.                                  JNIEnv *                env);
  715.  
  716. #endif  /* defined(JNI_H) */
  717.  
  718. #ifdef JRI_H
  719. EXTERN_API_C( jref )
  720. JMGetJMFrameObject                (JMFrameRef             frame);
  721.  
  722. #endif  /* defined(JRI_H) */
  723.  
  724. /*
  725.  * Window types
  726.  */
  727.  
  728. enum JMFrameKind {
  729.     eBorderlessModelessWindowFrame = 0,
  730.     eModelessWindowFrame        = 1,
  731.     eModalWindowFrame            = 2,
  732.     eModelessDialogFrame        = 3
  733. };
  734. typedef enum JMFrameKind JMFrameKind;
  735.  
  736.  
  737. /* JMAppletPageRef -
  738.  * Creating a "page" is optional. 
  739.  * Applets will share the same class loader (and thus static variables) iff
  740.  * they are share the same JMAppletPageRef and have the same codebase.
  741.  */
  742. EXTERN_API_C( OSStatus )
  743. JMNewAppletPage                    (JMAppletPageRef *        page,
  744.                                  JMSessionRef             session);
  745.  
  746. EXTERN_API_C( OSStatus )
  747. JMDisposeAppletPage                (JMAppletPageRef         page);
  748.  
  749.  
  750.  
  751. /* JMAWTContext -
  752.  * To create a top level frame, you must use a JMAWTContext object.
  753.  * The JMAWTContext provides a context for the AWT to request frames.
  754.  * A AWTContext has a threadgroup associated with it - all events and processing occurs
  755.  * there.  When you create one, it is quiescent, you must call resume before it begins executing.
  756.  */
  757. typedef CALLBACK_API_C( OSStatus , JMRequestFrameProcPtr )(JMAWTContextRef context, JMFrameRef newFrame, JMFrameKind kind, const Rect *initialBounds, Boolean resizeable, JMFrameCallbacks *callbacks);
  758. typedef CALLBACK_API_C( OSStatus , JMReleaseFrameProcPtr )(JMAWTContextRef context, JMFrameRef oldFrame);
  759. typedef CALLBACK_API_C( SInt16 , JMUniqueMenuIDProcPtr )(JMAWTContextRef context, Boolean isSubmenu);
  760. typedef CALLBACK_API_C( void , JMExceptionOccurredProcPtr )(JMAWTContextRef context, JMTextRef exceptionName, JMTextRef exceptionMsg, JMTextRef stackTrace);
  761.  
  762. struct JMAWTContextCallbacks {
  763.     UInt32                             fVersion;                    /* should be set to kJMVersion */
  764.     JMRequestFrameProcPtr             fRequestFrame;                /* a new frame is being created. */
  765.     JMReleaseFrameProcPtr             fReleaseFrame;                /* an existing frame is being destroyed. */
  766.     JMUniqueMenuIDProcPtr             fUniqueMenuID;                /* a new menu will be created with this id. */
  767.     JMExceptionOccurredProcPtr         fExceptionOccurred;            /* just some notification that some recent operation caused an exception.  You can't do anything really from here. */
  768. };
  769. typedef struct JMAWTContextCallbacks    JMAWTContextCallbacks;
  770. EXTERN_API_C( OSStatus )
  771. JMNewAWTContext                    (JMAWTContextRef *        context,
  772.                                  JMSessionRef             session,
  773.                                  const JMAWTContextCallbacks * callbacks,
  774.                                  JMClientData             data);
  775.  
  776. EXTERN_API_C( OSStatus )
  777. JMNewAWTContextInPage            (JMAWTContextRef *        context,
  778.                                  JMSessionRef             session,
  779.                                  JMAppletPageRef         page,
  780.                                  const JMAWTContextCallbacks * callbacks,
  781.                                  JMClientData             data);
  782.  
  783. EXTERN_API_C( OSStatus )
  784. JMDisposeAWTContext                (JMAWTContextRef         context);
  785.  
  786. EXTERN_API_C( OSStatus )
  787. JMGetAWTContextData                (JMAWTContextRef         context,
  788.                                  JMClientData *            data);
  789.  
  790. EXTERN_API_C( OSStatus )
  791. JMSetAWTContextData                (JMAWTContextRef         context,
  792.                                  JMClientData             data);
  793.  
  794. EXTERN_API_C( OSStatus )
  795. JMCountAWTContextFrames            (JMAWTContextRef         context,
  796.                                  UInt32 *                frameCount);
  797.  
  798. EXTERN_API_C( OSStatus )
  799. JMGetAWTContextFrame            (JMAWTContextRef         context,
  800.                                  UInt32                 frameIndex,
  801.                                  JMFrameRef *            frame);
  802.  
  803. /*
  804.  * Starting in MRJ 2.1, JMMenuSelected is deprecated.  Please use JMMenuSelectedWithModifiers instead.
  805.  */
  806. EXTERN_API_C( OSStatus )
  807. JMMenuSelected                    (JMAWTContextRef         context,
  808.                                  MenuHandle             hMenu,
  809.                                  short                     menuItem);
  810.  
  811. /*
  812.  * Starting in MRJ 2.1, this call takes an additional 'modifiers' parameter that you can get
  813.  * from your event record.
  814.  */
  815. EXTERN_API_C( OSStatus )
  816. JMMenuSelectedWithModifiers        (JMAWTContextRef         context,
  817.                                  MenuHandle             hMenu,
  818.                                  short                     menuItem,
  819.                                  short                     modifiers);
  820.  
  821. #ifdef JRI_H
  822. /*
  823.  * JRI Access APIs
  824.  */
  825. EXTERN_API_C( OSStatus )
  826. JMExecMethodInContext            (JMAWTContextRef         context,
  827.                                  jref                     objref,
  828.                                  JRIMethodID             methodID,
  829.                                  UInt32                 argCount,
  830.                                  JRIValue                 args[]);
  831.  
  832. EXTERN_API_C( OSStatus )
  833. JMExecStaticMethodInContext        (JMAWTContextRef         context,
  834.                                  JRIClassID             classID,
  835.                                  JRIMethodID             methodID,
  836.                                  UInt32                 argCount,
  837.                                  JRIValue                 args[]);
  838.  
  839. #endif  /* defined(JRI_H) */
  840.  
  841. #ifdef JNI_H
  842. /*
  843.  * JNI Access APIs
  844.  * Note that you must pass the JNIEnv to these as well.
  845.  */
  846. EXTERN_API_C( OSStatus )
  847. JMExecJNIMethodInContext        (JMAWTContextRef         context,
  848.                                  JNIEnv *                env,
  849.                                  jobject                 objref,
  850.                                  jmethodID                 methodID,
  851.                                  UInt32                 argCount,
  852.                                  jvalue                 args[]);
  853.  
  854. EXTERN_API_C( OSStatus )
  855. JMExecJNIStaticMethodInContext    (JMAWTContextRef         context,
  856.                                  JNIEnv *                env,
  857.                                  jclass                 classID,
  858.                                  jmethodID                 methodID,
  859.                                  UInt32                 argCount,
  860.                                  jvalue                 args[]);
  861.  
  862. #endif  /* defined(JNI_H) */
  863.  
  864. /*
  865.  * return a com.apple.mrj.JManager.JMAWTContext
  866.  */
  867. #ifdef JNI_H
  868. EXTERN_API_C( jobject )
  869. JMGetAwtContextJNIObject        (JMAWTContextRef         context,
  870.                                  JNIEnv *                env);
  871.  
  872. #endif  /* defined(JNI_H) */
  873.  
  874. #ifdef JRI_H
  875. EXTERN_API_C( jref )
  876. JMGetAwtContextObject            (JMAWTContextRef         context);
  877.  
  878. #endif  /* defined(JRI_H) */
  879.  
  880. #ifdef JNI_H
  881. /*
  882.  * Beginning in 2.1, this function maps a JNIEnv to the owning AWTContext, if one exists
  883.  */
  884. EXTERN_API_C( JMAWTContextRef )
  885. JMJNIToAWTContext                (JMSessionRef             session,
  886.                                  JNIEnv *                env);
  887.  
  888. #endif  /* defined(JNI_H) */
  889.  
  890.  
  891.  
  892. /*
  893.  * JMAppletLocator - Since Java applets are always referenced by a Uniform Resource Locator
  894.  * (see RFC 1737, http://www.w3.org/pub/WWW/Addressing/rfc1738.txt), we provide an object
  895.  * that encapsulates the information about a set of applets. A JMAppletLocator is built
  896.  * by providing a base URL, which must point at a valid HTML document containing applet
  897.  * tags. To save a network transaction, the contents of the document may be passed optionally. 
  898.  *
  899.  * You can also use a JMLocatorInfoBlock for a synchronous resolution of the applet,
  900.  * assuming that you already have the info for the tag.
  901.  */
  902.  
  903. enum JMLocatorErrors {
  904.     eLocatorNoErr                = 0,                            /* the html was retrieved successfully*/
  905.     eHostNotFound                = 1,                            /* the host specified by the url could not be found*/
  906.     eFileNotFound                = 2,                            /* the file could not be found on the host*/
  907.     eLocatorTimeout                = 3,                            /* a timeout occurred retrieving the html text*/
  908.     eLocatorKilled                = 4                                /* in response to a JMDisposeAppletLocator before it has completed*/
  909. };
  910. typedef enum JMLocatorErrors JMLocatorErrors;
  911.  
  912. typedef CALLBACK_API_C( void , JMFetchCompleted )(JMAppletLocatorRef ref, JMLocatorErrors status);
  913.  
  914. struct JMAppletLocatorCallbacks {
  915.     UInt32                             fVersion;                    /* should be set to kJMVersion */
  916.     JMFetchCompleted                 fCompleted;                    /* called when the html has been completely fetched */
  917. };
  918. typedef struct JMAppletLocatorCallbacks    JMAppletLocatorCallbacks;
  919. /*
  920.  * These structures are used to pass pre-parsed parameter
  921.  * tags to the AppletLocator.  Implies synchronous semantics.
  922.  */
  923.  
  924.  
  925. struct JMLIBOptionalParams {
  926.     JMTextRef                         fParamName;                    /* could be from a <parameter name=foo value=bar> or "zipbase", etc */
  927.     JMTextRef                         fParamValue;                /* the value of this optional tag */
  928. };
  929. typedef struct JMLIBOptionalParams        JMLIBOptionalParams;
  930.  
  931. struct JMLocatorInfoBlock {
  932.     UInt32                             fVersion;                    /* should be set to kJMVersion */
  933.  
  934.                                                                 /* These are required to be present and not nil */
  935.  
  936.     JMTextRef                         fBaseURL;                    /* the URL of this applet's host page */
  937.     JMTextRef                         fAppletCode;                /* code= parameter */
  938.     short                             fWidth;                        /* width= parameter */
  939.     short                             fHeight;                    /* height= parameter */
  940.  
  941.  
  942.                                                                 /* These are optional parameters */
  943.     SInt32                             fOptionalParameterCount;    /* how many in this array */
  944.     JMLIBOptionalParams *            fParams;                    /* pointer to an array of these (points to first element) */
  945. };
  946. typedef struct JMLocatorInfoBlock        JMLocatorInfoBlock;
  947. EXTERN_API_C( OSStatus )
  948. JMNewAppletLocator                (JMAppletLocatorRef *    locatorRef,
  949.                                  JMSessionRef             session,
  950.                                  const JMAppletLocatorCallbacks * callbacks,
  951.                                  JMTextRef                 url,
  952.                                  JMTextRef                 htmlText,
  953.                                  JMClientData             data);
  954.  
  955. EXTERN_API_C( OSStatus )
  956. JMNewAppletLocatorFromInfo        (JMAppletLocatorRef *    locatorRef,
  957.                                  JMSessionRef             session,
  958.                                  const JMLocatorInfoBlock * info,
  959.                                  JMClientData             data);
  960.  
  961. EXTERN_API_C( OSStatus )
  962. JMDisposeAppletLocator            (JMAppletLocatorRef     locatorRef);
  963.  
  964. EXTERN_API_C( OSStatus )
  965. JMGetAppletLocatorData            (JMAppletLocatorRef     locatorRef,
  966.                                  JMClientData *            data);
  967.  
  968. EXTERN_API_C( OSStatus )
  969. JMSetAppletLocatorData            (JMAppletLocatorRef     locatorRef,
  970.                                  JMClientData             data);
  971.  
  972. EXTERN_API_C( OSStatus )
  973. JMCountApplets                    (JMAppletLocatorRef     locatorRef,
  974.                                  UInt32 *                appletCount);
  975.  
  976. EXTERN_API_C( OSStatus )
  977. JMGetAppletDimensions            (JMAppletLocatorRef     locatorRef,
  978.                                  UInt32                 appletIndex,
  979.                                  UInt32 *                width,
  980.                                  UInt32 *                height);
  981.  
  982. EXTERN_API_C( OSStatus )
  983. JMGetAppletTag                    (JMAppletLocatorRef     locatorRef,
  984.                                  UInt32                 appletIndex,
  985.                                  JMTextRef *            tagRef);
  986.  
  987. EXTERN_API_C( OSStatus )
  988. JMGetAppletName                    (JMAppletLocatorRef     locatorRef,
  989.                                  UInt32                 appletIndex,
  990.                                  JMTextRef *            nameRef);
  991.  
  992.  
  993. /*
  994.  * JMAppletViewer - Applets are instantiated, one by one, by specifying a JMAppletLocator and
  995.  * a zero-based index (Macintosh API's usually use one-based indexing, the Java language
  996.  * uses zero, however.). The resulting applet is encapsulated in a JMAppletViewer object. 
  997.  * Since applets can have one or more visible areas to draw in, one or more JMFrame objects
  998.  * may be requested while the viewer is being created, or at a later time, thus the client
  999.  * must provide callbacks to satisfy these requests.
  1000.  *
  1001.  * The window name for the ShowDocument callback is one of:
  1002.  *   _self        show in current frame
  1003.  *   _parent    show in parent frame
  1004.  *   _top        show in top-most frame
  1005.  *   _blank        show in new unnamed top-level window
  1006.  *   <other>    show in new top-level window named <other> 
  1007.  */
  1008. typedef CALLBACK_API_C( void , JMShowDocumentProcPtr )(JMAppletViewerRef viewer, JMTextRef urlString, JMTextRef windowName);
  1009. typedef CALLBACK_API_C( void , JMSetStatusMsgProcPtr )(JMAppletViewerRef viewer, JMTextRef statusMsg);
  1010.  
  1011. struct JMAppletViewerCallbacks {
  1012.     UInt32                             fVersion;                    /* should be set to kJMVersion */
  1013.     JMShowDocumentProcPtr             fShowDocument;                /* go to a url, optionally in a new window */
  1014.     JMSetStatusMsgProcPtr             fSetStatusMsg;                /* applet changed status message */
  1015. };
  1016. typedef struct JMAppletViewerCallbacks    JMAppletViewerCallbacks;
  1017. /*
  1018.  * NEW: per-applet security settings
  1019.  * Previously, these settings were attached to the session.
  1020.  * JManager 2.0 allows them to be attached to each viewer.
  1021.  */
  1022.  
  1023. enum JMNetworkSecurityOptions {
  1024.     eNoNetworkAccess            = 0,
  1025.     eAppletHostAccess            = 1,
  1026.     eUnrestrictedAccess            = 2
  1027. };
  1028. typedef enum JMNetworkSecurityOptions JMNetworkSecurityOptions;
  1029.  
  1030.  
  1031. enum JMFileSystemOptions {
  1032.     eNoFSAccess                    = 0,
  1033.     eLocalAppletAccess            = 1,
  1034.     eAllFSAccess                = 2
  1035. };
  1036. typedef enum JMFileSystemOptions JMFileSystemOptions;
  1037.  
  1038. /*
  1039.  * Lists of packages are comma separated,
  1040.  * the default for mrj.security.system.access is
  1041.  * "sun,netscape,com.apple".
  1042.  */
  1043.  
  1044.  
  1045. struct JMAppletSecurity {
  1046.     UInt32                             fVersion;                    /* should be set to kJMVersion */
  1047.     JMNetworkSecurityOptions         fNetworkSecurity;            /* can this applet access network resources */
  1048.     JMFileSystemOptions             fFileSystemSecurity;        /* can this applet access network resources */
  1049.  
  1050.     Boolean                         fRestrictSystemAccess;        /* restrict access to system packages (com.apple.*, sun.*, netscape.*) also found in the property "mrj.security.system.access" */
  1051.     Boolean                         fRestrictSystemDefine;        /* restrict classes from loading system packages (com.apple.*, sun.*, netscape.*) also found in the property "mrj.security.system.define" */
  1052.  
  1053.     Boolean                         fRestrictApplicationAccess;    /* restrict access to application packages found in the property "mrj.security.application.access" */
  1054.     Boolean                         fRestrictApplicationDefine;    /* restrict access to application packages found in the property "mrj.security.application.access" */
  1055. };
  1056. typedef struct JMAppletSecurity            JMAppletSecurity;
  1057. /*
  1058.  * AppletViewer methods
  1059.  */
  1060. EXTERN_API_C( OSStatus )
  1061. JMNewAppletViewer                (JMAppletViewerRef *    viewer,
  1062.                                  JMAWTContextRef         context,
  1063.                                  JMAppletLocatorRef     locatorRef,
  1064.                                  UInt32                 appletIndex,
  1065.                                  const JMAppletSecurity * security,
  1066.                                  const JMAppletViewerCallbacks * callbacks,
  1067.                                  JMClientData             data);
  1068.  
  1069. EXTERN_API_C( OSStatus )
  1070. JMDisposeAppletViewer            (JMAppletViewerRef         viewer);
  1071.  
  1072. EXTERN_API_C( OSStatus )
  1073. JMGetAppletViewerData            (JMAppletViewerRef         viewer,
  1074.                                  JMClientData *            data);
  1075.  
  1076. EXTERN_API_C( OSStatus )
  1077. JMSetAppletViewerData            (JMAppletViewerRef         viewer,
  1078.                                  JMClientData             data);
  1079.  
  1080.  
  1081. /*
  1082.  * You can change the applet security on the fly
  1083.  */
  1084. EXTERN_API_C( OSStatus )
  1085. JMGetAppletViewerSecurity        (JMAppletViewerRef         viewer,
  1086.                                  JMAppletSecurity *        data);
  1087.  
  1088. EXTERN_API_C( OSStatus )
  1089. JMSetAppletViewerSecurity        (JMAppletViewerRef         viewer,
  1090.                                  const JMAppletSecurity * data);
  1091.  
  1092.  
  1093. /*
  1094.  * JMReloadApplet reloads viewer's applet from the source.
  1095.  * JMRestartApplet reinstantiates the applet without reloading.
  1096.  */
  1097. EXTERN_API_C( OSStatus )
  1098. JMReloadApplet                    (JMAppletViewerRef         viewer);
  1099.  
  1100. EXTERN_API_C( OSStatus )
  1101. JMRestartApplet                    (JMAppletViewerRef         viewer);
  1102.  
  1103.  
  1104. /*
  1105.  * JMSuspendApplet tells the Java thread scheduler to stop executing the viewer's applet.
  1106.  * JMResumeApplet resumes execution of the viewer's applet.
  1107.  */
  1108. EXTERN_API_C( OSStatus )
  1109. JMSuspendApplet                    (JMAppletViewerRef         viewer);
  1110.  
  1111. EXTERN_API_C( OSStatus )
  1112. JMResumeApplet                    (JMAppletViewerRef         viewer);
  1113.  
  1114.  
  1115. /* 
  1116.  * To get back to the JMAppletViewerRef instance from whence a frame came,
  1117.  * as well as the ultimate frame parent (the one created _for_ the applet viewer)
  1118.  */
  1119. EXTERN_API_C( OSStatus )
  1120. JMGetFrameViewer                (JMFrameRef             frame,
  1121.                                  JMAppletViewerRef *    viewer,
  1122.                                  JMFrameRef *            parentFrame);
  1123.  
  1124. /*
  1125.  * To get a ref back to the Frame that was created for this JMAppletViewerRef
  1126.  */
  1127. EXTERN_API_C( OSStatus )
  1128. JMGetViewerFrame                (JMAppletViewerRef         viewer,
  1129.                                  JMFrameRef *            frame);
  1130.  
  1131. /*
  1132.  * To get the ref of the com.apple.mrj.JManager.JMAppletViewer java object
  1133.  */
  1134. #ifdef JNI_H
  1135. EXTERN_API_C( jobject )
  1136. JMGetAppletViewerJNIObject        (JMAppletViewerRef         viewer,
  1137.                                  JNIEnv *                env);
  1138.  
  1139. #endif  /* defined(JNI_H) */
  1140.  
  1141. #ifdef JRI_H
  1142. EXTERN_API_C( jref )
  1143. JMGetAppletViewerObject            (JMAppletViewerRef         viewer);
  1144.  
  1145. #endif  /* defined(JRI_H) */
  1146.  
  1147. /*
  1148.  * To get the ref of the java.applet.Applet itself
  1149.  */
  1150. #ifdef JNI_H
  1151. EXTERN_API_C( jobject )
  1152. JMGetAppletJNIObject            (JMAppletViewerRef         viewer,
  1153.                                  JNIEnv *                env);
  1154.  
  1155. #endif  /* defined(JNI_H) */
  1156.  
  1157. #ifdef JRI_H
  1158. EXTERN_API_C( jref )
  1159. JMGetAppletObject                (JMAppletViewerRef         viewer);
  1160.  
  1161. #endif  /* defined(JRI_H) */
  1162.  
  1163. /*
  1164.  * Tell MRJ to add connID to its list of shared libraries used when searching for
  1165.  * JNI (and JRI) native methods. This is useful for overriding or redirecting
  1166.  * a java call to System.loadLibrary().  In particular System.loadLibrary()
  1167.  * does not reuse CFM connections to libraries already open by someone outside
  1168.  * of the java session.  It always forces its own private copy of a shared library 
  1169.  * to be opened.  This can result in multiple instances of the data/TOC section
  1170.  * of a shared library.  
  1171.  * Note: This function has no effect on JDirect based native methods.
  1172.  * If connID exports a function named "JNI_OnLoad", it is immediately called.
  1173.  * If javaShouldClose is true, MRJ will close the connection when the session is closed.
  1174.  * Returns false and does nothing if a library with that name is already registered.
  1175.  */
  1176. EXTERN_API_C( Boolean )
  1177. JMRegisterLibrary                (JMSessionRef             session,
  1178.                                  ConstStr63Param         libraryName,
  1179.                                  CFragConnectionID         connID,
  1180.                                  Boolean                 javaShouldClose);
  1181.  
  1182.  
  1183.  
  1184.  
  1185. #if PRAGMA_ENUM_ALWAYSINT
  1186.     #pragma enumsalwaysint reset
  1187. #elif PRAGMA_ENUM_OPTIONS
  1188.     #pragma option enum=reset
  1189. #elif defined(PRAGMA_ENUM_PACK__JMANAGER__)
  1190.     #pragma options(pack_enums)
  1191. #endif
  1192.  
  1193. #if PRAGMA_STRUCT_ALIGN
  1194.     #pragma options align=reset
  1195. #elif PRAGMA_STRUCT_PACKPUSH
  1196.     #pragma pack(pop)
  1197. #elif PRAGMA_STRUCT_PACK
  1198.     #pragma pack()
  1199. #endif
  1200.  
  1201. #ifdef PRAGMA_IMPORT_OFF
  1202. #pragma import off
  1203. #elif PRAGMA_IMPORT
  1204. #pragma import reset
  1205. #endif
  1206.  
  1207. #ifdef __cplusplus
  1208. }
  1209. #endif
  1210.  
  1211. #endif /* __JMANAGER__ */
  1212.  
  1213.